<form action="{:sysuri()}" method="post" data-auto="true" class="layui-form layui-card" data-table-id="navTable">

    <div class="layui-card-body">

        {if $account_show}
        <div class="layui-form-item">
            <label class="layui-form-label">{:Lang("学校")}:</label>
            <div class="layui-input-block">
                <select name="account_id" lay-search class="layui-select" lay-filter="platform" required vali-name="{:lang('学校')}">
                    <option value=''>-- {:lang('全部')} --</option>
                    {if !empty($account_arr)}
                    {foreach $account_arr as $key => $name}
                    <option value="{$key}" {if !empty($vo.account_id) && ($vo.account_id == $key)} selected {/if}>{$name|default=''}</option>
                    {/foreach}
                    {/if}
                </select>
            </div>
        </div>
        {/if}

        <div class="layui-form-item">
            <label class="layui-form-label ">{:lang('标题')}:</label>
            <div class="layui-input-block">
                <input name="title" value='{$vo.title|default=""}' required vali-name="{:lang('文章标题')}" placeholder="{:lang('请输入文章标题')}" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label label-required-next">{:lang('简介')}:</label>
            <div class="layui-input-block">
                <textarea name="intro" placeholder="{:lang('请输入简介')}" required class="layui-textarea">{$vo.intro|default=""}</textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label label-required-next">{:lang('类型')}:</label>
            <div class="layui-input-block">
                {if !empty($typeArr) }
                {assign name='count' value='0' }
                {foreach $typeArr as $key => $value}
                    <input {$count++} type="radio" name="type" value="{$key}" title="{$value}" {if !empty($vo.type) && ($vo.type == $key)}checked{/if} {if empty($vo.type) && ($count == 1)}checked{/if}>
                {/foreach}
                {/if}
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label label-required-next">{:lang('封面图')}:</label>
            <div class="layui-input-block">
                <div class="layui-col-md12">
                    <div class="layui-col-md4">
                        <button type="button" class="layui-btn" data-file='one' data-type='png,jpg,gif,jpeg' data-field='cover'>
                            <i class="layui-icon layui-icon-upload"></i> {:lang('上传图片')}
                        </button>
                        <input type="hidden" name="cover" value="{$vo.cover|default=''}">
                    </div>
                    <div class="layui-col-md8">
                        <div style="width: 135px;">
                            <div class="layui-upload-list">
                              <img class="layui-upload-img" name="cover_url" style="width: 100%; height: 92px;" {notempty name='vo.cover'} src="{$vo.cover|default=''}" {/notempty}>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label label-required-next">{:lang('内容')}:</label>
            <div class="layui-input-block">
                <textarea name="content" placeholder="{:lang('请输入内容')}" required class="layui-textarea">{$vo.content|default=""}</textarea>
            </div>
        </div>
    </div>

    <div class="hr-line-dashed"></div>
    {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}

    <div class="layui-form-item text-center">
        <button class="layui-btn" type='submit'>{:lang('保存数据')}</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="{:lang('确定要取消编辑吗？')}" data-close>{:lang('取消编辑')}</button>
    </div>
</form>
<style type="text/css">
    .ck-editor__editable {
        min-height: 400px;
        max-height: 400px;
    }
</style>
<script type="text/javascript">
    $(function () {
        // 捕获上传文件
        $('form input[name=cover]').on('change', function () {
            // 文件地址变量事件
            $('form img[name=cover_url]').attr('src', this.value);
        });
        require(['ckeditor', 'angular'], function () {
            setTimeout(function () {
                // 初始化富文本编辑器
                window.createEditor('[name=content]', {height: 400});
            },100)
        })
    })
</script>